package com.whitehatsec.sentineldataexchange.model;

/**
 * Class to represent a WhiteHat Vulnerability.
 *
 * @author August Detlefsen [augustd@codemagi.com]
 * Copyright 2011 WhiteHat Security
 */
public class WhiteHatVulnerability {

	private String vulnID = null;
	private String siteID = null;
	private String requestURL = null;
	private String dateFound = null;
	private String status = null;
	private int severity = 0;
	private int threat = 0;
	private int score = 0;
	private String vulnClass = null;
	private String description = null;
	private String solution = null;
	private String href = null;
	private String attackVectors = null;

	public void setVulnID(String i) {
		this.vulnID = i;
	}

	public String getVulnID() {
		return this.vulnID;
	}

	public void setSiteID(String s) {
		this.siteID = s;
	}

	public String getSiteID() {
		return this.siteID;
	}

	public void setRequestUrl(String s) {
		this.requestURL = s;
	}

	public String getRequestUrl() {
		return this.requestURL;
	}

	public void setDateFound(String dateFound) {
		this.dateFound = dateFound;
	}

	public String getDateFound() {
		return this.dateFound;
	}

	public void setStatus(String s) {
		this.status = s;
	}

	public String getStatus() {
		return this.status;
	}

	public void setSeverity(int n) {
		this.severity = n;
	}

	public int getSeverity() {
		return this.severity;
	}

	public String getSeverityStr() {
		String ret = null;

		switch (this.getSeverity()) {
		case 1: {
			ret = "Low";
			break;
		}
		case 2: {
			ret = "Medium";
			break;
		}
		case 3: {
			ret = "High";
			break;
		}
		case 4: {
			ret = "Critical";
			break;
		}
		case 5: {
			ret = "Urgent";
			break;
		}
		default: {
			// run in circles, scream and shout
		}
		}
		return ret;
	}

	public void setThreat(int n) {
		this.threat = n;
	}

	public int getThreat() {
		return this.threat;
	}

	public int getScore() {
		return this.score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public String getVulnClass() {
		return this.vulnClass;
	}

	public void setVulnClass(String s) {
		this.vulnClass = s;
	}

	public void setDescription(String d) {
		this.description = d;
	}

	public String getDescription() {
		return this.description;
	}

	public void setSolution(String s) {
		this.solution = s;
	}

	public String getSolution() {
		return this.solution;
	}

	public void setHRef(String s) {
		this.href = s;
	}

	public String getHRef() {
		return this.href;
	}

	public String getAttackVectors() {
		return attackVectors;
	}

	public void setAttackVectors(String attackVectors) {
		this.attackVectors = attackVectors;
	}

	@Override
	public String toString() {
		String ret =
				"Vuln ID: " + this.vulnID + "\n"
				+ "Site ID: " + this.siteID + "\n"
				+ "Class: " + this.vulnClass + "\n"
				+ "Request URL: " + this.requestURL + "\n"
				+ "Date Found: " + this.dateFound + "\n"
				+ "Status: " + this.status + "\n"
				+ "Severity: " + this.getSeverityStr() + "\n"
				+ "Threat: " + this.threat + "\n"
				+ "Score: " + this.score + "\n"
				+ "Description: " + this.description + "\n"
				+ "Solution: " + this.solution + "\n"
				+ "HRef: " + this.href + "\n";

		return ret;
	}
}
